import java.util.Scanner;
class NumExchange {
    int x = 0;
    int y = 0;
}
public class Test6 {

    //1. 写代码实现: 给定两个 int 变量, 交换变量的值
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        NumExchange num = new NumExchange();
        num.x = scan.nextInt();
        num.y = scan.nextInt();
        System.out.printf("交换前：%d %d",num.x,num.y);
        System.out.println();
        System.out.println("=================");
        func(num);
    }
    public static void func (NumExchange num) {
        int tmp = 0;
        tmp = num.x;
        num.x = num.y;
        num.y = tmp;
        System.out.printf("交换后：%d %d",num.x,num.y);
    }
    //2. 写代码实现: 给定三个 int 变量, 求其中的最大值和最小值
    public static int  func1(int a,int b,int c) {
        return (a>b?a:b)>c?(a>b?a:b):c;
    }
    public static int func2(int a,int b,int c) {
        return (a<b?a:b)<c?(a<b?a:b):c;
    }
    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int max = func1(a,b,c);
        int min = func2(a,b,c);
        System.out.printf("最大：%d，最小：%d",max,min);
    }
    public static int  func3(int n) {
        if(n==0) {return 0;}
        if(n==1) {return 1;}
        return func3(n-1)+func3(n-2);
    }
    public static void main3(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int ret = func3(n);
        System.out.println(ret);
    }

    public static int  func5(int sum) {
        int ret = 0;
        ret += sum;
        return ret;
    }
    //递归求 N 的阶乘
    public static int  func4(int n) {
        if (n == 1) {
            return 1;
        }
        return n * func4(n-1);
    }
    public static void main4(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int x = func4(n);
        System.out.println(x);
    }
    //递归求 1 + 2 + 3 + ... + 10
    public static int func6(int n) {
        if(n == 1) {
            return 1;
        }
        return func6(n-1) + n;
    }
    public static void main7(String[] args) {
        int k = func6(10);
        System.out.println(k);
    }
    //按顺序打印一个数字的每一位(例如 1234 打印出 1 2 3 4) （递归
    public static void print (int n) {
        if(n > 9) {
            print(n/10);
        }
        System.out.println(n % 10);
    }
    public static void main8(String[] args) {
        print(1234);
    }
    //写一个递归方法，输入一个非负整数，返回组成它的数字之和
    public static int func (int k) {

        if(k < 9) {
            return k;
        }
        return func(k / 10) + k % 10;
    }
    public static void main9(String[] args) {
        Scanner scan = new Scanner(System.in);
        if(scan.hasNextInt()){
            int k = scan.nextInt();
            int x = func(k);
            System.out.println(x);
        }

    }
    public static int  fibo (int n) {
        if(n == 0) {
            return 0;
        }
        if(n == 1) {
            return 1;
        }
        return fibo(n-2) + fibo(n-1);
    }
    public static void main10(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = fibo(n);
        System.out.println(k);
    }

    public static void main(String[] args) {

    }
}